home *** CD-ROM | disk | FTP | other *** search
/ Win '95 Giga Pack / Win95 Giga Pack (Maple Media) (1997).iso / UTILITY / WNBT32 / WILLANG.WB_ < prev    next >
Text File  |  1995-10-29  |  2KB  |  88 lines

  1. ;Language change applet for Winbatch
  2.  
  3. IntControl(29, @TAB, 0, 0, 0)     ; standardize on tab delimters
  4. ;Change to WinBatch home dir to find WWWDLANG.* files
  5. a=FileLocate("wwwdlang.enu")
  6. if a==""
  7.    Message("Could not locate WWWDLANG.ENU")
  8.    exit
  9. endif
  10. DirChange(FilePath(a))
  11.  
  12. MyDialogFormat=`WWWDLGED,5.0`
  13.  
  14. MyDialogCaption=`WIL Language Selector`
  15. MyDialogX=60
  16. MyDialogY=79
  17. MyDialogWidth=289
  18. MyDialogHeight=146
  19. MyDialogNumControls=6
  20.  
  21. MyDialog01=`2,66,278,56,ITEMBOX,Choice,DEFAULT`
  22. MyDialog02=`20,22,270,DEFAULT,VARYTEXT,current,""`
  23. MyDialog03=`54,126,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Ok",1`
  24. MyDialog04=`148,126,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0`
  25. MyDialog05=`10,6,114,DEFAULT,STATICTEXT,DEFAULT,"Current Language is:"`
  26. MyDialog06=`10,46,272,DEFAULT,STATICTEXT,DEFAULT,"Select desired language"`
  27.  
  28.  
  29. ;Determine current language
  30.  
  31. Current=inireadpvt("Main","Language","NONE","WWWBATCH.INI")
  32. if Current=="NONE"
  33.    current="English"
  34. else
  35.    if strlen(Current)!=3 then current="enu"
  36.    current=IniReadPvt("Main","Description","Unknown",strcat(DirGet(),"WWWDLANG.",current))
  37. endif   
  38.  
  39. LangFiles=strupper(FileItemize("WWWDLANG.*"))
  40. a=ItemLocate("WWWDLANG.DLL",LangFiles,@TAB)
  41. if a!=0 then LangFiles=ItemRemove(a,LangFiles,@TAB)
  42. LangFiles=ItemSort(LangFiles,@TAB)
  43.  
  44. LangCount=ItemCount(LangFiles,@TAB)
  45. if LangCount==0
  46.    Message("Language","No WWWDLANG.* Language files found.  Using English")
  47.    return
  48. endif
  49.  
  50. LangList=""
  51. for i=1 to LangCount
  52.    lfile=ItemExtract(i,LangFiles,@TAB)
  53.    Lang=IniReadPvt("Main","Description","NONE",strcat(DirGet(),lfile))
  54.    if Lang=="NONE" then Lang=FileExtension (lfile)
  55.    if i<LangCount then LangList=strcat(LangList,Lang,@tab)
  56.    else LangList=strcat(LangList,Lang)
  57. next 
  58.  
  59.  
  60. :tryagain
  61. choice=LangList
  62. Dialog("MyDialog")
  63.   
  64. if Choice=="" then return
  65. if ItemCount(Choice,@tab)>1 
  66.    Display(4,"Language","You may only select one language")
  67.    goto tryagain
  68. endif
  69.  
  70. a=ItemLocate(choice,LangList,@tab)
  71. lfile=ItemExtract(a,LangFiles,@TAB)
  72. ext=FileExtension(lfile)
  73.  
  74. if ext=="ENU"
  75.    IniDeletePvt("Main","Language","WWWBATCH.INI")
  76.    Message("English chosen as langauge","DLL Will use internal strings instead of language file")
  77. else
  78.    IniWritePvt("Main","Language",ext,"WWWBATCH.INI")
  79.    Message("Language","Language set to %Choice%")
  80. endif
  81.  
  82. IntControl(26,0,0,0,0)   ;Tell DLL to reset language strings
  83.  
  84. return
  85.  
  86.  
  87.  
  88.